﻿function PollutantWarmcharts() {
    this.container = null;
    this.chartType = 'pie';
    this.series = [];
    this.subtitleText = null;
    this.titleText = null;
    this.legendUseHTML = false;
    this.exportingFileName = "chart";
    this.DrawChart = function () {
        this.container.highcharts({
            lang: {
                contextButtonTitle: '导出图片',
                loading: '加载中',
                noData: '没有数据'
            },
            chart: {
                type: this.chartType,
                plotBackgroundColor: null,
                plotBorderWidth: null,
                plotShadow: false
            },
            credits: {
                enabled: false
            },
            exporting: {
                buttons: {
                    contextButton: {
                        menuItems: null,
                        onclick: function () {
                            this.exportChartLocal();
                        }
                    }
                },
                filename: this.exportingFileName,
                sourceHeight: this.container.height(),
                sourceWidth: this.container.width()
            },
            legend: {
                align: 'center',   //right,left,center
                layout: 'horizontal',   //vertical,horizontal
                useHTML: this.legendUseHTML
            },
            series: [{
                //type: 'pie',
                name: 'AQI百分比',
                data: this.series

            }],
            subtitle: {
                text: this.subtitleText,
                useHTML: true
            },
            title: {
                text: this.titleText,
                useHTML: false
            },
            tooltip: {
                pointFormat: '<b>{point.percentage:.2f}%</b>'
            }
        });
    };
}